package com.smh.a22ThreadPoolDemo2;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class MyThreadPoolDemo1 {
    public static void main(String[] args) {

        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                3,//核心线程数量
                6,//最大线程数量,临时线程=最大线程数-核心线程数.且只有在任务队列满了之后才会创建临时队列
                60,//最大空闲时间
                TimeUnit.SECONDS,//60秒
                new ArrayBlockingQueue<>(3),//任务队列
                Executors.defaultThreadFactory(),//创建线程工厂
                new ThreadPoolExecutor.AbortPolicy()//任务的拒绝策略
        );
        pool.submit(new Thread());
        pool.shutdown();

    }
}
